class Solution(object):
    def letterCasePermutation(self, s):
        """
        :type s: str
        :rtype: List[str]
        """
        n = len(s)
        s = s.lower()
        out = set()
        for i in range(2 ** n):
            t = ''
            for j in range(n):
                if '0' <= s[j] <= '9':
                    t += s[j]
                else:
                    if (i >> j) & 1 == 1:
                        t += s[j].upper()
                    else:
                        t += s[j]
            out.add(t)
        return list(out)

data = Solution()
s = "a1b2"
print(data.letterCasePermutation(s))

